﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KinConquer.Packets.Structures
{
    public unsafe struct LoginResponse
    {
        public ushort Size;
        public ushort Type;

        public UInt32 Seed;
        public UInt32 Identifier;

        public UInt32 GamePort;
        private fixed sbyte szIPAddress[16];

        public unsafe string IPAddress
        {
            get { fixed (sbyte* bp = szIPAddress) { return new string(bp); } }
            set
            {
                string ip = value;
                fixed (sbyte* bp = szIPAddress)
                {
                    for (int i = 0; i < ip.Length; i++)
                        bp[i] = (sbyte)ip[i];
                }
            }
        }

        public static LoginResponse Create()
        {
            LoginResponse retn = new LoginResponse();
            retn.Size = 0x20;
            retn.Type = 0x41F;
            return retn;
        }
    }
}
